import React from 'react';
import ReactDOM from 'react-dom';
import { HashRouter, Route, Link,Switch } from "react-router-dom";
import thunk from 'redux-thunk';
import {Provider} from 'react-redux';
import './index.css';
import * as serviceWorker from './serviceWorker';
import rootReducer from './reducers'
//import websocket from '@giantmachines/redux-websocket'
import {createStore, applyMiddleware} from 'redux';
import Register from './containers/Register';
import Login from './containers/Login';
import Friend from './containers/Friend';
import Match from './containers/Match'
import AnonymousChat from './containers/AnonymousChat'

const store = createStore(rootReducer,applyMiddleware(thunk))
//const store = createStore(rootReducer,applyMiddleware(thunk,websocket))
ReactDOM.render(
<Provider store={store}>
<HashRouter>
    <Switch>
       <Route exact path="/Register" component={Register}/>
       <Route exact path="/" component={Login}/>
       <Route exact path="/Friend" component={Friend}/>
       <Route exact path="/AnonymousChat" component={AnonymousChat}/>
       <Route exact path="/Match" component={Match}/>
    </Switch>
</HashRouter>
</Provider>
,document.getElementById('root'));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
serviceWorker.unregister();

